import os, sys
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
from string import LinkString

def lcmp(cstr1, cstr2):
    s1 = LinkString()
    s2 = LinkString()
    s1.StrAssign(cstr1)
    s2.StrAssign(cstr2)
    minlen = min(s1.getsize(), s2.getsize())
    p1 = s1.head.next
    p2 = s2.head.next
    for i in range(minlen):
        if p1.data > p2.data:
            return 1
        if p1.data < p2.data:
            return 2
        p1 = p1.next
        p2 = p2.next
    if s1.getsize() > s2.getsize():
        return 1
    elif s1.getsize() < s2.getsize():
        return 2
    else:
        return 0     
    

if __name__ == "__main__":
    cstr1 = "aaaaas"
    cstr2 = "aaaaass"
    print(lcmp(cstr1, cstr2))